package com.peakmain.wanandroid.mymodule.adapter;

import android.content.Context;
import android.widget.TextView;

import com.peakmain.baselibrary.recyclerview.adapter.CommonRecyclerAdapter;
import com.peakmain.baselibrary.recyclerview.adapter.ViewHolder;
import com.peakmain.minemodule.R;
import com.peakmain.wanandroid.netmodule.bean.PublicAccountListBean;

import java.util.List;

/**
 * author: peakmain
 * createdata：2019/7/25
 * mail: 2726449200@qq.com
 * desiption:
 */
public class PopupAdpater extends CommonRecyclerAdapter<PublicAccountListBean>{
    private int mSelectPosition;

    public PopupAdpater(Context context, List<PublicAccountListBean> data) {
        super(context, data, R.layout.item_popup_window);
    }

    @Override
    public void convert(ViewHolder holder, PublicAccountListBean item) {
         TextView tvName=holder.getView(R.id.tv_name);
         tvName.setText(item.getName());
        if(mSelectPosition==holder.getAdapterPosition()){
            tvName.setTextColor(mContext.getResources().getColor(R.color.colorAccent));
        }else{
            tvName.setTextColor(mContext.getResources().getColor(R.color.color_3));
        }
    }

    public void selectPosition(int selectPosition){
        this.mSelectPosition=selectPosition;
        notifyDataSetChanged();
    }
}
